﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using HSJM.Service.MWS.Core;
using HSJM.Service.MWS.Domain.Condition;
using HSJM.Service.MWS.Domain.Domain.Base;
using HSJM.Service.MWS.Domain.Entitys;
using HSJM.Service.MWS.Infrastructure;
using Microsoft.Extensions.Primitives;
using Microsoft.IdentityModel.Tokens;
using StackExchange.Redis;

namespace HSJM.Service.MWS.Domain.Domain
{
    public class TestDomain : BaseDomain<Test, BaseTestCondition>,ITestDomain
    {

        public TestDomain(IRepository<Test> Repository) :base(Repository)
        {
        }

        /// <summary>
        /// 拼接sql
        /// </summary>
        /// <param name="condition"></param>
        /// <returns></returns>
        public override string TrunConditionToSql(BaseTestCondition condition)
        {
            var sql = new StringBuilder();
            //if (!string.IsNullOrEmpty(condition.Title))
            //{
            //    sql.Append($" AND Title='{condition.Title}'" );
            //}
            if (!string.IsNullOrEmpty(condition.Title))
            {
                sql.Append($" AND Title like '%{condition.Title}%'");
            }
            return sql.ToString();
        }
    }
}
